package com.xjtu.se.homework.client.result.controller;


import com.xjtu.se.homework.client.result.service.ClientResultService;
import com.xjtu.se.homework.common.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/helper/result")
public class ClientResultAPI {
    @Resource
    private ClientResultService clientResultService;

    @PostMapping("/updateMistake")
    public Result insertMistake(@RequestParam("search_id") String search_id,@RequestParam("is_marked") String is_marked) {
        clientResultService.updateMistakeBySearchID(search_id, Integer.parseInt(is_marked));
        return Result.success("增加错题成功");
    }

    @PostMapping("/getMistake")
    public int getMistake(@RequestParam("search_id") String search_id) {
        return clientResultService.getMistakeBySearchID(search_id);
    }

}
